/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CadastrarEquipe.java
 *
 * Created on 12/06/2009, 19:01:26
 */
package Negocios;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;

/**
 *
 * @author Administrador
 */
public class CadastrarEquipe extends javax.swing.JInternalFrame {

    ResultSet rs = null;
    int codcurso = 0;
    int codmodalidade = 0;
    String update = "";
    int codequipe = 0;

    public CadastrarEquipe() {

        initComponents();

        try {
            String SQL = "Select nm_modalidade from modalidade";
            ModalidadeEquipejComboBox.removeAllItems();

            rs = Conexão.conexãoJDBC.createStatement().executeQuery(SQL);
            DefaultComboBoxModel model = (DefaultComboBoxModel) ModalidadeEquipejComboBox.getModel();
            ModalidadeEquipejComboBox.removeAllItems();
            while (rs.next()) {
                ModalidadeEquipejComboBox.addItem(rs.getString("nm_modalidade"));
            }
        } catch (SQLException ex) {
            Logger.getLogger(CadastrarAluno.class.getName()).log(Level.SEVERE, null, ex);
        }




    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        EntidadebuttonGroup = new javax.swing.ButtonGroup();
        CadastrarEquipejButton = new javax.swing.JButton();
        EditarEquipejButton = new javax.swing.JButton();
        ExcluirEquipejButton = new javax.swing.JButton();
        IntegrantesEquipejPanel = new javax.swing.JPanel();
        RMIntegrantejLabel = new javax.swing.JLabel();
        NomeCompletoIntegrantejLabel = new javax.swing.JLabel();
        RM1jTextField = new javax.swing.JTextField();
        NomejTextField1 = new javax.swing.JTextField();
        RM2jTextField = new javax.swing.JTextField();
        NomejTextField2 = new javax.swing.JTextField();
        RM3jTextField = new javax.swing.JTextField();
        NomejTextField3 = new javax.swing.JTextField();
        RM4jTextField = new javax.swing.JTextField();
        NomejTextField4 = new javax.swing.JTextField();
        RM5jTextField = new javax.swing.JTextField();
        NomejTextField5 = new javax.swing.JTextField();
        RM6jTextField = new javax.swing.JTextField();
        NomejTextField6 = new javax.swing.JTextField();
        RM7jTextField = new javax.swing.JTextField();
        NomejTextField7 = new javax.swing.JTextField();
        RM8jTextField = new javax.swing.JTextField();
        NomejTextField8 = new javax.swing.JTextField();
        RM9jTextField = new javax.swing.JTextField();
        NomejTextField9 = new javax.swing.JTextField();
        RM10jTextField = new javax.swing.JTextField();
        NomejTextField10 = new javax.swing.JTextField();
        RM11jTextField = new javax.swing.JTextField();
        NomejTextField11 = new javax.swing.JTextField();
        RM12jTextField = new javax.swing.JTextField();
        NomejTextField12 = new javax.swing.JTextField();
        DadosEquipejPanel = new javax.swing.JPanel();
        NomeEquipejLabel = new javax.swing.JLabel();
        NomeEquipejTextField = new javax.swing.JTextField();
        EntidadejPanel = new javax.swing.JPanel();
        FatecEquipejRadioButton = new javax.swing.JRadioButton();
        EtecEquipejRadioButton = new javax.swing.JRadioButton();
        CursoEquipejPanel = new javax.swing.JPanel();
        CursoEquipejComboBox = new javax.swing.JComboBox();
        ModalidadeEquipejComboBox = new javax.swing.JComboBox();
        ModalidadeEquipejLabel = new javax.swing.JLabel();

        setClosable(true);
        setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        setIconifiable(true);
        setTitle("Cadastrar Equipe");

        CadastrarEquipejButton.setText("Cadastrar");
        CadastrarEquipejButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CadastrarEquipejButtonActionPerformed(evt);
            }
        });

        EditarEquipejButton.setText("Editar");

        ExcluirEquipejButton.setText("Excluir");

        IntegrantesEquipejPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Integrantes"));

        RMIntegrantejLabel.setText("RM");

        NomeCompletoIntegrantejLabel.setText("Nome Completo");

        RM1jTextField.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                RM1jTextFieldFocusLost(evt);
            }
        });

        NomejTextField1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                NomejTextField1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout IntegrantesEquipejPanelLayout = new javax.swing.GroupLayout(IntegrantesEquipejPanel);
        IntegrantesEquipejPanel.setLayout(IntegrantesEquipejPanelLayout);
        IntegrantesEquipejPanelLayout.setHorizontalGroup(
            IntegrantesEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(IntegrantesEquipejPanelLayout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addGroup(IntegrantesEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(IntegrantesEquipejPanelLayout.createSequentialGroup()
                        .addComponent(RM12jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(35, 35, 35)
                        .addComponent(NomejTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, 444, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(IntegrantesEquipejPanelLayout.createSequentialGroup()
                        .addComponent(RM11jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(35, 35, 35)
                        .addComponent(NomejTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, 444, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(IntegrantesEquipejPanelLayout.createSequentialGroup()
                        .addComponent(RM10jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(35, 35, 35)
                        .addComponent(NomejTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, 444, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(IntegrantesEquipejPanelLayout.createSequentialGroup()
                        .addComponent(RM9jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(35, 35, 35)
                        .addComponent(NomejTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, 444, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(IntegrantesEquipejPanelLayout.createSequentialGroup()
                        .addComponent(RM8jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(35, 35, 35)
                        .addComponent(NomejTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, 444, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(IntegrantesEquipejPanelLayout.createSequentialGroup()
                        .addComponent(RM7jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(35, 35, 35)
                        .addComponent(NomejTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 444, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(IntegrantesEquipejPanelLayout.createSequentialGroup()
                        .addComponent(RM6jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(35, 35, 35)
                        .addComponent(NomejTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 444, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(IntegrantesEquipejPanelLayout.createSequentialGroup()
                        .addComponent(RM5jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(35, 35, 35)
                        .addComponent(NomejTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 444, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(IntegrantesEquipejPanelLayout.createSequentialGroup()
                        .addComponent(RM4jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(35, 35, 35)
                        .addComponent(NomejTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 444, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(IntegrantesEquipejPanelLayout.createSequentialGroup()
                        .addComponent(RM3jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(35, 35, 35)
                        .addComponent(NomejTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 444, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(IntegrantesEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(IntegrantesEquipejPanelLayout.createSequentialGroup()
                            .addComponent(RM2jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(35, 35, 35)
                            .addComponent(NomejTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 444, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(IntegrantesEquipejPanelLayout.createSequentialGroup()
                            .addGroup(IntegrantesEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(RMIntegrantejLabel)
                                .addComponent(RM1jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(35, 35, 35)
                            .addGroup(IntegrantesEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(NomeCompletoIntegrantejLabel)
                                .addComponent(NomejTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 444, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(107, Short.MAX_VALUE))
        );
        IntegrantesEquipejPanelLayout.setVerticalGroup(
            IntegrantesEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(IntegrantesEquipejPanelLayout.createSequentialGroup()
                .addGap(4, 4, 4)
                .addGroup(IntegrantesEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(RMIntegrantejLabel)
                    .addComponent(NomeCompletoIntegrantejLabel))
                .addGap(6, 6, 6)
                .addGroup(IntegrantesEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(RM1jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(NomejTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(IntegrantesEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(RM2jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(NomejTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(IntegrantesEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(RM3jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(NomejTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(IntegrantesEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(RM4jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(NomejTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(6, 6, 6)
                .addGroup(IntegrantesEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(RM5jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(NomejTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(6, 6, 6)
                .addGroup(IntegrantesEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(RM6jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(NomejTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(6, 6, 6)
                .addGroup(IntegrantesEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(RM7jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(NomejTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(6, 6, 6)
                .addGroup(IntegrantesEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(RM8jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(NomejTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(6, 6, 6)
                .addGroup(IntegrantesEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(RM9jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(NomejTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(6, 6, 6)
                .addGroup(IntegrantesEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(RM10jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(NomejTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(6, 6, 6)
                .addGroup(IntegrantesEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(RM11jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(NomejTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(IntegrantesEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(RM12jTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(NomejTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(11, Short.MAX_VALUE))
        );

        DadosEquipejPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Dados da Equipe"));

        NomeEquipejLabel.setText("Nome da Equipe");

        EntidadejPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Entidade de Ensino"));

        EntidadebuttonGroup.add(FatecEquipejRadioButton);
        FatecEquipejRadioButton.setText("FATEC");
        FatecEquipejRadioButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                FatecEquipejRadioButtonActionPerformed(evt);
            }
        });

        EntidadebuttonGroup.add(EtecEquipejRadioButton);
        EtecEquipejRadioButton.setText("ETEC");
        EtecEquipejRadioButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EtecEquipejRadioButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout EntidadejPanelLayout = new javax.swing.GroupLayout(EntidadejPanel);
        EntidadejPanel.setLayout(EntidadejPanelLayout);
        EntidadejPanelLayout.setHorizontalGroup(
            EntidadejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(EntidadejPanelLayout.createSequentialGroup()
                .addComponent(FatecEquipejRadioButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(EtecEquipejRadioButton)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        EntidadejPanelLayout.setVerticalGroup(
            EntidadejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(EntidadejPanelLayout.createSequentialGroup()
                .addGroup(EntidadejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(FatecEquipejRadioButton)
                    .addComponent(EtecEquipejRadioButton))
                .addContainerGap(10, Short.MAX_VALUE))
        );

        CursoEquipejPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Curso"));

        CursoEquipejComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CursoEquipejComboBoxActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout CursoEquipejPanelLayout = new javax.swing.GroupLayout(CursoEquipejPanel);
        CursoEquipejPanel.setLayout(CursoEquipejPanelLayout);
        CursoEquipejPanelLayout.setHorizontalGroup(
            CursoEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(CursoEquipejPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(CursoEquipejComboBox, 0, 0, Short.MAX_VALUE)
                .addContainerGap())
        );
        CursoEquipejPanelLayout.setVerticalGroup(
            CursoEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(CursoEquipejPanelLayout.createSequentialGroup()
                .addComponent(CursoEquipejComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(18, Short.MAX_VALUE))
        );

        ModalidadeEquipejLabel.setText("Modalidade");

        javax.swing.GroupLayout DadosEquipejPanelLayout = new javax.swing.GroupLayout(DadosEquipejPanel);
        DadosEquipejPanel.setLayout(DadosEquipejPanelLayout);
        DadosEquipejPanelLayout.setHorizontalGroup(
            DadosEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(DadosEquipejPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(DadosEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(DadosEquipejPanelLayout.createSequentialGroup()
                        .addComponent(NomeEquipejLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(NomeEquipejTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 316, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(ModalidadeEquipejLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(ModalidadeEquipejComboBox, 0, 207, Short.MAX_VALUE))
                    .addGroup(DadosEquipejPanelLayout.createSequentialGroup()
                        .addGap(34, 34, 34)
                        .addComponent(EntidadejPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(60, 60, 60)
                        .addComponent(CursoEquipejPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(9, 9, 9)))
                .addContainerGap())
        );
        DadosEquipejPanelLayout.setVerticalGroup(
            DadosEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(DadosEquipejPanelLayout.createSequentialGroup()
                .addGroup(DadosEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(NomeEquipejLabel)
                    .addComponent(NomeEquipejTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ModalidadeEquipejLabel)
                    .addComponent(ModalidadeEquipejComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(DadosEquipejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(EntidadejPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(CursoEquipejPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(IntegrantesEquipejPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(CadastrarEquipejButton)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(EditarEquipejButton)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(ExcluirEquipejButton)
                                .addGap(27, 27, 27))
                            .addComponent(DadosEquipejPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addContainerGap(30, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(DadosEquipejPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(29, 29, 29)
                .addComponent(IntegrantesEquipejPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(CadastrarEquipejButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(EditarEquipejButton)
                    .addComponent(ExcluirEquipejButton))
                .addContainerGap(101, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void CadastrarEquipejButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CadastrarEquipejButtonActionPerformed
        String NomeEquipe, Modalidade, Curso;


        int Ciclo, Entidade;
        String Rm[] = new String[12];
        String Integrante[] = new String[12];


        NomeEquipe = NomeEquipejTextField.getText();
        Modalidade = (String) ModalidadeEquipejComboBox.getSelectedItem();
        Curso = (String) CursoEquipejComboBox.getSelectedItem();

        if (FatecEquipejRadioButton.isSelected()) {
            Entidade = 1;
        } else {
            Entidade = 2;

        }

        Rm[0] = RM1jTextField.getText();
        Rm[1] = RM2jTextField.getText();
        Rm[2] = RM3jTextField.getText();
        Rm[3] = RM4jTextField.getText();
        Rm[4] = RM5jTextField.getText();
        Rm[5] = RM6jTextField.getText();
        Rm[6] = RM7jTextField.getText();
        Rm[7] = RM8jTextField.getText();
        Rm[8] = RM9jTextField.getText();
        Rm[9] = RM10jTextField.getText();
        Rm[10] = RM11jTextField.getText();
        Rm[11] = RM12jTextField.getText();



        try {
            String SQL = "Select cd_curso from Curso where nm_curso like '" + Curso + "'";

            rs = Conexão.conexãoJDBC.createStatement().executeQuery(SQL);
            while (rs.next()) {
                codcurso = rs.getInt("cd_curso");
            }
        } catch (SQLException ex) {
            Logger.getLogger(CadastrarAluno.class.getName()).log(Level.SEVERE, null, ex);
        }

        System.out.println(codcurso);

        try {
            String SQL = "Select cd_modalidade from modalidade where nm_modalidade like '" + ModalidadeEquipejComboBox.getSelectedItem() + "'";

            rs = Conexão.conexãoJDBC.createStatement().executeQuery(SQL);
            while (rs.next()) {
                codmodalidade = rs.getInt("cd_modalidade");
            }
        } catch (SQLException ex) {
            Logger.getLogger(CadastrarAluno.class.getName()).log(Level.SEVERE, null, ex);
        }

        Integrante[0] = NomejTextField1.getText();


        Integrante[1] = NomejTextField2.getText();
        {
            if (Integrante[1].equals("")) {
                Integrante[1] = "NULL";
            } else {
                Integrante[1] = NomejTextField2.getText();
            }
        }

        Integrante[2] = NomejTextField3.getText();
        {
            if (Integrante[2].equals("")) {
                Integrante[2] = "NULL";
            } else {
                Integrante[2] = NomejTextField3.getText();
            }
        }


        Integrante[3] = NomejTextField4.getText();
        {
            if (Integrante[3].equals("")) {
                Integrante[3] = "NULL";
            } else {
                Integrante[3] = NomejTextField4.getText();
            }
        }

        Integrante[4] = NomejTextField5.getText();
        {
            if (Integrante[4].equals("")) {
                Integrante[4] = "NULL";
            } else {
                Integrante[4] = NomejTextField5.getText();
            }
        }

        Integrante[5] = NomejTextField6.getText();
        {
            if (Integrante[5].equals("")) {
                Integrante[5] = "NULL";
            } else {
                Integrante[5] = NomejTextField6.getText();
            }
        }

        Integrante[6] = NomejTextField7.getText();
        {
            if (Integrante[6].equals("")) {
                Integrante[6] = "NULL";
            } else {
                Integrante[6] = NomejTextField7.getText();
            }
        }

        Integrante[7] = NomejTextField8.getText();
        {
            if (Integrante[7].equals("")) {
                Integrante[7] = "NULL";
            } else {
                Integrante[7] = NomejTextField8.getText();
            }
        }

        Integrante[8] = NomejTextField9.getText();
        {
            if (Integrante[8].equals("")) {
                Integrante[8] = "NULL";
            } else {
                Integrante[8] = NomejTextField9.getText();
            }
        }

        Integrante[9] = NomejTextField10.getText();
        {
            if (Integrante[9].equals("")) {
                Integrante[9] = "NULL";
            } else {
                Integrante[9] = NomejTextField10.getText();
            }
        }

        Integrante[10] = NomejTextField11.getText();
        {
            if (Integrante[10].equals("")) {
                Integrante[10] = "NULL";
            } else {
                Integrante[10] = NomejTextField11.getText();
            }
        }


        Integrante[11] = NomejTextField12.getText();
        {
            if (Integrante[11].equals("")) {
                Integrante[11] = "NULL";
            } else {
                Integrante[11] = NomejTextField12.getText();
            }
        }


        String SQL = "INSERT INTO hr.equipe (cd_equipe, nm_equipe,  cd_curso, cd_modalidade) values (seq_equipe.nextval, '" + NomeEquipe + "'," + codcurso + "," + codmodalidade + ")";
       
        System.out.println("sql: " + SQL);
        try {

            Conexão.conexãoJDBC.createStatement().execute(SQL);
         
           
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(this, "O registro não pode ser inserido.Erro: " + ex.getMessage(),
                    "Erro",
                    JOptionPane.ERROR_MESSAGE);

        }

         try {
            String sql2 = "Select cd_equipe from equipe where nm_equipe like '" + NomeEquipe + "'";

            rs = Conexão.conexãoJDBC.createStatement().executeQuery(sql2);
            while (rs.next()) {
                codequipe = rs.getInt("cd_equipe");
            }
        } catch (SQLException ex) {
            Logger.getLogger(CadastrarAluno.class.getName()).log(Level.SEVERE, null, ex);
        }

        for (int y = 0; y < 12; y++) {

            update = "UPDATE hr.Aluno set cd_equipe = " + codequipe + " where cd_aluno = " + Rm[y];

            if(!Rm[y].equals("")){
            try {
                Conexão.conexãoJDBC.createStatement().execute(update);
            } catch (SQLException ex) {
                JOptionPane.showMessageDialog(this, "O registro não pode ser inserido.Erro: " + ex.getMessage(),
                        "Erro",
                        JOptionPane.ERROR_MESSAGE);

            }
            }
            else
            {
                y++;
            }
        }
           JOptionPane.showMessageDialog(null, "Cadastro Realizado com sucesso!");
         this.setVisible(false);
         
    }//GEN-LAST:event_CadastrarEquipejButtonActionPerformed

    private void CursoEquipejComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CursoEquipejComboBoxActionPerformed
    }//GEN-LAST:event_CursoEquipejComboBoxActionPerformed

    private void FatecEquipejRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FatecEquipejRadioButtonActionPerformed

        CursoEquipejComboBox.removeAllItems();

        try {
            String SQL = "Select nm_curso from Curso where cd_entidade_ensino = 1";
            CursoEquipejComboBox.removeAllItems();

            rs = Conexão.conexãoJDBC.createStatement().executeQuery(SQL);
            DefaultComboBoxModel model = (DefaultComboBoxModel) CursoEquipejComboBox.getModel();
            CursoEquipejComboBox.removeAllItems();
            while (rs.next()) {
                CursoEquipejComboBox.addItem(rs.getString("nm_curso"));
            }
        } catch (SQLException ex) {
            Logger.getLogger(CadastrarAluno.class.getName()).log(Level.SEVERE, null, ex);
        }


    }//GEN-LAST:event_FatecEquipejRadioButtonActionPerformed

    private void EtecEquipejRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EtecEquipejRadioButtonActionPerformed
        CursoEquipejComboBox.removeAllItems();

        try {
            String SQL = "Select nm_curso from Curso where cd_entidade_ensino = 2";
            CursoEquipejComboBox.removeAllItems();

            rs = Conexão.conexãoJDBC.createStatement().executeQuery(SQL);
            DefaultComboBoxModel model = (DefaultComboBoxModel) CursoEquipejComboBox.getModel();
            CursoEquipejComboBox.removeAllItems();
            while (rs.next()) {
                CursoEquipejComboBox.addItem(rs.getString("nm_curso"));
            }
        } catch (SQLException ex) {
            Logger.getLogger(CadastrarAluno.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_EtecEquipejRadioButtonActionPerformed

private void RM1jTextFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_RM1jTextFieldFocusLost
}//GEN-LAST:event_RM1jTextFieldFocusLost

private void NomejTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NomejTextField1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_NomejTextField1ActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton CadastrarEquipejButton;
    private javax.swing.JComboBox CursoEquipejComboBox;
    private javax.swing.JPanel CursoEquipejPanel;
    private javax.swing.JPanel DadosEquipejPanel;
    private javax.swing.JButton EditarEquipejButton;
    private javax.swing.ButtonGroup EntidadebuttonGroup;
    private javax.swing.JPanel EntidadejPanel;
    private javax.swing.JRadioButton EtecEquipejRadioButton;
    private javax.swing.JButton ExcluirEquipejButton;
    private javax.swing.JRadioButton FatecEquipejRadioButton;
    private javax.swing.JPanel IntegrantesEquipejPanel;
    private javax.swing.JComboBox ModalidadeEquipejComboBox;
    private javax.swing.JLabel ModalidadeEquipejLabel;
    private javax.swing.JLabel NomeCompletoIntegrantejLabel;
    private javax.swing.JLabel NomeEquipejLabel;
    private javax.swing.JTextField NomeEquipejTextField;
    private javax.swing.JTextField NomejTextField1;
    private javax.swing.JTextField NomejTextField10;
    private javax.swing.JTextField NomejTextField11;
    private javax.swing.JTextField NomejTextField12;
    private javax.swing.JTextField NomejTextField2;
    private javax.swing.JTextField NomejTextField3;
    private javax.swing.JTextField NomejTextField4;
    private javax.swing.JTextField NomejTextField5;
    private javax.swing.JTextField NomejTextField6;
    private javax.swing.JTextField NomejTextField7;
    private javax.swing.JTextField NomejTextField8;
    private javax.swing.JTextField NomejTextField9;
    private javax.swing.JTextField RM10jTextField;
    private javax.swing.JTextField RM11jTextField;
    private javax.swing.JTextField RM12jTextField;
    private javax.swing.JTextField RM1jTextField;
    private javax.swing.JTextField RM2jTextField;
    private javax.swing.JTextField RM3jTextField;
    private javax.swing.JTextField RM4jTextField;
    private javax.swing.JTextField RM5jTextField;
    private javax.swing.JTextField RM6jTextField;
    private javax.swing.JTextField RM7jTextField;
    private javax.swing.JTextField RM8jTextField;
    private javax.swing.JTextField RM9jTextField;
    private javax.swing.JLabel RMIntegrantejLabel;
    // End of variables declaration//GEN-END:variables
}


